<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <canvas id="canvas" width="1000" height="800"></canvas>
  <script>
    /** @type {HTMLCanvasElement} */
    var canvas=document.querySelector("#canvas")
    var ctx=canvas.getContext("2d")
    var ding=new Path2D()
    ding.moveTo(500,200)
    ding.lineTo(800,200)
    ding.lineTo(850,300)
    ding.lineTo(450,300)
    ding.lineTo(500,200)
    ctx.strokeStyle="skyblue"
    ctx.stroke(ding)
    var ti=new Path2D()
    ti.moveTo(500,300)
    ti.lineTo(500,500)
    ti.lineTo(800,500)
    ti.lineTo(800,300)
    ti.lineTo(500,300)
    ctx.strokeStyle="red"
    ctx.stroke(ti)
    var men=new Path2D()
    men.moveTo(600,500)
    men.lineTo(600,400)
    men.lineTo(700,400)
    men.lineTo(700,500)
    men.moveTo(650,500)
    men.lineTo(650,400)
    men.moveTo(700,340)
    men.lineTo(740,340)
    men.lineTo(740,380)
    men.lineTo(700,380)
    men.lineTo(700,340)
    men.moveTo(720,340)
    men.lineTo(720,380)
    men.moveTo(700,360)
    men.lineTo(740,360)
    var index=0
    ctx.strokeStyle="black"
    ctx.setLineDash([5,5])
    setInterval(function(){
      ctx.clearRect(600,400,100,100)
      ctx.clearRect(700,340,40,40)
      index++
      ctx.lineDashOffset=index
      ctx.stroke(men)
    },10)
    
    // ctx.strokeStyle="red"
    
  </script>
</body>
</html>